/**
 * PanelModuloMaterias.java
 */

 /**
 *  AdSec: Administrador de Secundarias
 *  Copyright (C) 2009 Daniela Ramírez Chaves (dannyrch@gmail.com)
 *  Copyright (C) 2009 Leonel Salazar Valverde (leo87sv@gmail.com)
 *
 *  This file is part of AdSec.
 *  AdSec is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  AdSec is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with AdSec.  If not, see <http://www.gnu.org/licenses/>.
 */

package adsec.presentacion;

import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;


public class PanelModuloMaterias extends javax.swing.JPanel implements ChangeListener {

    private static final int PANEL_MATERIAS = 0;
    private static final int PANEL_CICLO_LECTIVO = 1;
    /** Creates new form PanelModuloMaterias */
    public PanelModuloMaterias() {
        initComponents();
        this.panelMaterias.iniciarPanelMaterias();
    }

    public void stateChanged(ChangeEvent e) {
        int i = this.tabModuloMaterias.getSelectedIndex();
        if (i != -1) {
            switch(i){
                case PANEL_MATERIAS:
                    this.panelMaterias.iniciarPanelMaterias();
                break;
                case PANEL_CICLO_LECTIVO:
                    this.panelCicloLectivo.iniciarPanelCicloLectivo();
                break;

            }
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        tabModuloMaterias = new javax.swing.JTabbedPane();
        panelMaterias = new adsec.presentacion.PanelMaterias();
        panelCicloLectivo = new adsec.presentacion.PanelCicloLectivo();

        setMinimumSize(new java.awt.Dimension(665, 801));
        setName("Form"); // NOI18N

        tabModuloMaterias.setName("tabModuloMaterias"); // NOI18N

        panelMaterias.setName("panelMaterias"); // NOI18N
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(adsec.presentacion.LiceoEscazuApp.class).getContext().getResourceMap(PanelModuloMaterias.class);
        tabModuloMaterias.addTab(resourceMap.getString("panelMaterias.TabConstraints.tabTitle"), panelMaterias); // NOI18N

        panelCicloLectivo.setName("panelCicloLectivo"); // NOI18N
        tabModuloMaterias.addTab(resourceMap.getString("panelCicloLectivo.TabConstraints.tabTitle"), panelCicloLectivo); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tabModuloMaterias)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tabModuloMaterias, javax.swing.GroupLayout.PREFERRED_SIZE, 802, Short.MAX_VALUE)
        );

        this.tabModuloMaterias.addChangeListener(this);
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private adsec.presentacion.PanelCicloLectivo panelCicloLectivo;
    private adsec.presentacion.PanelMaterias panelMaterias;
    private javax.swing.JTabbedPane tabModuloMaterias;
    // End of variables declaration//GEN-END:variables

}
